class Student {
  fullName: string;

  // 在构造函数的参数上使用public等同于创建了同名的成员变量。
  constructor(public firstName: string, public middleInitial: string, public lastName: string) {
    this.fullName = `${firstName} ${middleInitial} ${lastName}`;
  }
}

interface Person {
  firstName: string;
  lastName: string;
}

function greeter(person: Person): string {
  return `Hello, ${person.firstName} ${person.lastName}`;
}

// 注意类和接口可以一起共作，程序员可以自行决定抽象的级别。
const user = new Student('Jane', 'M.', 'User');

document.body.innerHTML = greeter(user);
export {};
